import service from './service';

/**
 * 调用过帐服务
 * @param service_name 服务名称
 * @param condition 参数
 * @param usercode 用户名
 * @param spaceid 项目spaceid
 * @param systemid 项目systemid
 * @param emptydataflag 空数据标识
 * @param refsystemid 项目refsystemid
 * @example execute(url, service_name, condition, usercode, spaceid, systemid, emptydataflag, refsystemid)
 */
export default async function execute<T>(service_name: string, condition: any, usercode: string, spaceid: string, systemid: string, emptydataflag: number, refsystemid?: string) {
	const params = {
		condition,
		emptydataflag,
		modelid: service_name,
		refsystemid: refsystemid || systemid,
		spaceid,
		systemid,
		usercode
	};
	return await service<T>('dataservice.executeaccount', params);
}
